const TOKEN_KEY = 'geek-park';

export const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

// 设置token
export const setToken = (token) => {
  localStorage.setItem(TOKEN_KEY, token);
};

// 删除token
export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

// 判断是否有token
export const hasToken = () => {
  // !!强制类型转换为boolean，等同于Boolean()
  return !!getToken();
};
